import { pubRequire } from '@utils/public'
const baseUrl = '/users'
const baseUrl1='/coupons'
//获取列表
export function getSearchList(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callBack, errBack)
}
//停用
export function disable(id, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}/disable`, '', callBack, errBack)
}
//启用
export function enable(id, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}/enable`, '', callBack, errBack)
}
//批量删除
export function multipleDel(obj, callBack, errBack) {
  return pubRequire('delete', `${baseUrl}`, obj, callBack, errBack)
}
//单个删除
export function singleDel(userId, callBack, errBack) {
  return pubRequire('delete', `${baseUrl}/${userId}`, '', callBack, errBack)
}
//校验是否重复
export function checkRepeat(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/verifications`, obj, callBack, errBack)
}
//获取用户详情
export function getDetail(userId, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/${userId}`, '', callBack, errBack)
}
//新增用户角色
export function addRole(callBack, errBack) {
  return pubRequire('get', `/roles/dict`, '', callBack, errBack)
}
//编辑用户角色
export function editRole(userId, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/${userId}/roles`, '', callBack, errBack)
}
//编辑用户
export function editUsert(userId, obj, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${userId}`, obj, callBack, errBack)
}
//重置密码
export function resetPass(userId, obj, callBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${userId}/reset-pwd`,
    obj,
    callBack,
    errBack
  )
}
//获取大鹏号/获取所有的运营用户
export function getDpNum(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/options`, obj, callbBack, errBack)
}

//大鹏号导入接口
export function importUrl() {
  return `${baseUrl}/import/dp-account`
}
//大鹏号下载接口
export function downloadUrl() {
  return `${baseUrl}/download/dp-account`
}

//获取手机号/获取所有的运营用户
export function getIpNum(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl1}/options`, obj, callbBack, errBack)
}

//手机号导入接口
export function importMobileUrl() {
  return `${baseUrl1}/import/mobile`
}
//手机号下载接口
export function downloadMobileUrl() {
  return `/system?type=mobile`
}

//添加用户-提交表单-批量导入
export function multipleImportUser(formData, callBack, errBack) {
  return pubRequire(
    'post',
    `${baseUrl}/import/dp-account/`,
    formData,
    callBack,
    errBack
  )
}

//收货地址列表
export function getAddressList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/receiving-address`, obj, callbBack, errBack)
}

//某一用户的收货地址列表
export function getUserAddressList(userId, obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/${userId}/receiving-address`, obj, callbBack, errBack)
}

//修改地址
export function updateUserAddress(addressId, obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl}/receiving-address/${addressId}`, obj, callbBack, errBack)
}
